package com.kongmou.Springmvc.service;

import java.util.Calendar;

import org.springframework.scheduling.annotation.Scheduled;
import org.springframework.stereotype.Service;
import org.springframework.web.context.request.async.DeferredResult;

@Service
public class PushService {

	private DeferredResult<String> deferredResult;
	
	public DeferredResult<String> getDeferreResult(){
		DeferredResult<String> deferredResult = new DeferredResult<>();
		return deferredResult;
	}
	
	@Scheduled(fixedDelay = 1000)
	public void refresh(){
		if(null != deferredResult){
			deferredResult.setResult(String.valueOf(Calendar.getInstance().getTimeInMillis()));
		}
	}
}
